<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    // 检查session是否存在
    if(session.getAttribute("username") == null) {
        response.sendRedirect(request.getContextPath() + "/login.jsp");
        return;
    }
    String username = (String)session.getAttribute("username");
    String role = (String)session.getAttribute("role");
    Object user = session.getAttribute("user");
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>公司用车管理系统（司机）- 系统首页</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        /* 全局样式 */
        body {
            margin: 0;
            padding: 0;
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: #f6f6f6;
            color: #333;
        }

        /* 头部样式 */
        .header {
            background: #183a8a;
            color: #fff;
            font-size: 2rem;
            font-weight: bold;
            padding: 10px 0 10px 10px;
            letter-spacing: 2px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .header-right {
            display: flex;
            align-items: center;
            margin-right: 30px;
            font-size: 1rem;
        }
        .user-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #fff;
            color: #183a8a;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            margin-right: 10px;
        }
        .user-info {
            margin-right: 20px;
            color: #fff;
        }
        .bell-icon {
            font-size: 1.3rem;
            margin-right: 20px;
            color: #fff;
        }
        .logout {
            color: #fff;
            text-decoration: none;
            margin-left: 10px;
            font-size: 1rem;
            padding: 8px 15px;
            border-radius: 4px;
            background: rgba(255,255,255,0.1);
            transition: background 0.3s ease;
        }
        .logout:hover {
            background: rgba(255,255,255,0.2);
        }

        /* 主体容器 */
        .container {
            display: flex;
            height: calc(100vh - 56px);
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 220px;
            background: #183a8a;
            display: flex;
            flex-direction: column;
            padding-top: 10px;
            box-shadow: 2px 0 8px rgba(24,58,138,0.05);
        }
        .menu-item {
            color: #fff;
            padding: 18px 0 18px 32px;
            font-size: 1.15rem;
            cursor: pointer;
            border-left: 5px solid transparent;
            transition: background 0.2s, border 0.2s;
            text-decoration: none;
            display: flex;
            align-items: center;
        }
        .menu-item i {
            margin-right: 10px;
            width: 20px;
            text-align: center;
        }
        .menu-item.active, .menu-item:hover {
            background: #2450a7;
            border-left: 5px solid #fff;
            font-weight: bold;
            box-shadow: 0 4px 8px rgba(24,58,138,0.10);
        }
        .menu-item::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 2px;
            background: #fff;
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }
        .menu-item:hover::after {
            transform: scaleX(1);
        }

        /* 主内容区样式 */
        .main-content {
            flex: 1;
            background: #fff;
            border: 2px solid #3ba0e9;
            border-left: none;
            padding: 30px;
            overflow-y: auto;
        }
        .page-title {
            font-size: 2.2rem;
            color: #183a8a;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #eee;
            position: relative;
        }
        .page-title::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 100px;
            height: 2px;
            background: #3ba0e9;
        }

        /* 仪表盘卡片样式 */
        .dashboard-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        .card {
            background: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 12px rgba(0,0,0,0.15);
        }
        .card-title {
            color: #666;
            font-size: 1.1rem;
            margin-bottom: 10px;
        }
        .card-value {
            color: #183a8a;
            font-size: 2.5rem;
            font-weight: bold;
        }

        /* 最近活动样式 */
        .recent-activity {
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            padding: 25px;
        }
        .recent-activity h2 {
            color: #183a8a;
            margin-bottom: 20px;
            font-size: 1.5rem;
        }
        .activity-list {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .activity-item {
            padding: 15px 0;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background-color 0.3s ease;
        }
        .activity-item:hover {
            background-color: #f8f9fa;
        }
        .activity-item:last-child {
            border-bottom: none;
        }
        .activity-time {
            color: #666;
            font-size: 0.9rem;
        }

        /* 响应式设计 */
        @media (max-width: 900px) {
            .sidebar {
                width: 120px;
            }
            .menu-item {
                padding-left: 15px;
                font-size: 1rem;
            }
            .dashboard-cards {
                grid-template-columns: 1fr;
            }
            .header {
                font-size: 1.5rem;
                padding: 10px;
            }
            .user-info {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="header">
        <div>欢迎登录公司用车管理系统（司机）</div>
        <div class="header-right">
            <div class="user-icon">👤</div>
            <div class="user-info">工号：<%=username%></div>
            <div class="bell-icon">🔔</div>
            <a href="<%=request.getContextPath()%>/login.jsp" class="logout">退出登录</a>
        </div>
    </div>

    <div class="container">
        <div class="sidebar">
            <a class="menu-item active" href="DriversServlet?action=1234">
                <i class="fas fa-home"></i> 系统首页
            </a>
            <a class="menu-item" href="DriversServlet?action=a">
                <i class="fas fa-user"></i> 个人中心
            </a>
            <a class="menu-item" href="DriversServlet?action=c">
                <i class="fas fa-list"></i> 全部订单
            </a>
            <a class="menu-item" href="DriversServlet?action=d">
                <i class="fas fa-tools"></i> 维修单提交
            </a>
            <a class="menu-item" href="DriversServlet?action=e">
                <i class="fas fa-money-bill-wave"></i> 用车费用提交
            </a>
        </div>

        <div class="main-content">
            <h1 class="page-title">系统概览</h1>
            
            <div class="dashboard-cards">
                <div class="card">
                    <div class="card-title">今日待执行订单</div>
                    <div class="card-value">3</div>
                </div>
                <div class="card">
                    <div class="card-title">本周完成订单</div>
                    <div class="card-value">12</div>
                </div>
                <div class="card">
                    <div class="card-title">待报销费用</div>
                    <div class="card-value">2</div>
                </div>
                <div class="card">
                    <div class="card-title">待维修车辆</div>
                    <div class="card-value">1</div>
                </div>
            </div>

            <div class="recent-activity">
                <h2>最近活动</h2>
                <ul class="activity-list">
                    <li class="activity-item">
                        <div>完成订单 #12345 的用车服务</div>
                        <div class="activity-time">10分钟前</div>
                    </li>
                    <li class="activity-item">
                        <div>提交了维修申请 #REP2023001</div>
                        <div class="activity-time">30分钟前</div>
                    </li>
                    <li class="activity-item">
                        <div>提交了费用报销申请 #EXP2023001</div>
                        <div class="activity-time">1小时前</div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</body>
</html>